package 牛客网_N.查找_递归_排序_贪心.数组中的逆序对;

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		String str = in.nextLine();
		String[] dataStr = str.split(" ");
		int[] A = new int[dataStr.length];
		for(int i = 0; i < dataStr.length; i++){
			A[i] = Integer.parseInt(dataStr[i]);
		}
		System.out.println(count(A, n));
	}
	
	public static int count(int[] A, int n){
		int count = 0;
		for(int i = 0; i < A.length; i++){
			for(int j = i+1; j < A.length; j++ ){
				if(A[i] > A[j]) count++;
			}
		}
		return count;
	}
}
